<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>宜 鲜 生</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <!-- load css -->
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css?v=v3.3.7" media="all">
    <link rel="stylesheet" type="text/css" href="css/font/iconfont.css?v=1.0.0" media="all">
    <link rel="stylesheet" type="text/css" href="css/layui.css?v=1.0.9" media="all">
    <link rel="stylesheet" type="text/css" href="css/main.css?v1.3.4" media="all">

    <style>
        #form1 .layui-btn {
            width: 100%
        }
    </style>
</head>

<body>
    <div class="container-fluid larry-wrapper">
        <div class="row">
<!--
            <div class="col-xs-12 col-sm-8 col-md-4 col-md-offset-4 col-sm-offset-2 ">
-->
            <div class="col-xs-12 col-sm-8 col-md-6 col-lg-4 col-md-offset-3 col-sm-offset-2 col-lg-offset-4">
                <!--头部搜索-->
                <section class="panel panel-padding login-pane">
                    <h1 class="head-title">宜鲜生登录</h1>
                    <form class="layui-form layui-form-pane" id="form1" action="/education/admin/login/vali"
                          style="margin:30px;">
                        <div class="layui-form-item">
                            <label class="layui-form-label"><i class="iconfont">&#xe623;</i>  账 号</label>
                            <div class="layui-input-block">
                                <input type="text" name="username" required jq-verify="required" placeholder="" aut
                                       ocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label"><i class="iconfont">&#xe68a;</i>  密 码</label>
                            <div class="layui-input-block">
                                <input type="password" name="password" required jq-verify="required" placeholder="" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label"><i class="iconfont">&#xe668;</i> 验证码</label>
                            <div class="layui-input-inline">
                                <input type="text" name="authCode"  placeholder=""
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div>
                                <a href="#" id="authImg">
                                    <img src="../platform/authImg?rand=332" alt=""
                                         style="width: 90px;height: 40px;"/>
                                </a>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <!--<label class="layui-form-label"><i class="iconfont">&#xe6a1;</i> 记住我</label>-->
                            <div class="layui-input-block">
                                <input type="checkbox" name="remember" lay-skin="switch" >
                                <span class="font-pt">记住我的登录</span>
                            </div>
                        </div>
                        <div class="layui-form-item" style="padding-top: 20px;">
                            <div class="layui-input-block">
                                <!--<button class="layui-btn ajax" jq-submit jq-filter="submit"
                                        data-params='{"url": "/education/admin/login/vali","data":"id=1&name=jqcool","loading":"false"}'
                                        >立即提交</button>-->
                                <button class="layui-btn" lay-submit lay-filter="login"
                                        data-params='{"url": "/education/admin/login/vali","data":"id=1&name=jqcool","loading":"false"}'
                                        >
                                    <i class="layui-icon"><!--&#xe650;--></i>  登 录
                                </button>
                            </div>
                        </div>
                    </form>
                </section>

            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="js/lib/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script src="js/layui/layui.js"></script>
<!--#include file="common/version.html"-->
<script>
    layui.define(['jquery', 'jqform', 'element', 'layer'], function(exports) {
        var $ = layui.jquery,
                layedit = layui.layedit,
                f = layui.form(),
                form = layui.jqform;

        form.set({
            "blur": true,
            "form": "#form1"
//            "complete": "logined"
        }).init();

        $('#authImg').click(function(){
            var imageHtml = '<img src="../platform/authImg?rand=' + Math.random() + '" style="width: 90px;height: 40px;"/>';
            $(this).html(imageHtml);
        });

        f.on('submit(login)', function(data){
            $.post('/education/admin/login/vali', data.field, function(rs){
                if(rs.status == 200){
                    //$.cookie('authmark', rs.data.authmark);
                    $.cookie('name', rs.data.name);
                    location.href = 'index.html';
                } else {
                    $('#authImg').trigger('click');
                    layer.msg(rs.msg);
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        document.onkeydown = function(e){
            var ev = document.all ? window.event : e;
            if(ev.keyCode==13) {
                $('.layui-btn').trigger('click')
            }
        }
    });

</script>

</html>